import { readConfig } from './storage.js';

export function getUpstreamBaseUrl() {
  const stored = readConfig();
  const envUrl = process.env.OPENAI_BASE_URL || '';
  const base = (stored.baseUrl || envUrl || 'https://api.openai.com').replace(/\/$/, '');
  return base;
}

export function getApiKey() {
  const stored = readConfig();
  const envKey = process.env.OPENAI_API_KEY || '';
  return stored.apiKey || envKey || '';
}

export function getDefaultModel() {
  const stored = readConfig();
  return stored.defaultModel || process.env.OPENAI_DEFAULT_MODEL || 'gpt-4o-mini';
}





